package com.naiterui.ehp.bs.b2c.order.service;

import java.util.List;
import java.util.Map;
import java.util.Set;

import com.naiterui.common.repository.page.PageParamVO;
import com.naiterui.common.repository.page.PageVO;
import com.naiterui.ehp.bp.bo.agent.CustomOrderInfoBO;
import com.naiterui.ehp.bp.bo.b2c.OrderDeliveryBO;
import com.naiterui.ehp.bp.bo.b2c.UpdateOrderBO;
import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bp.utils.payment.bo.NotifyBusinessPayBO;
import com.naiterui.ehp.bs.b2c.common.bo.order.PayTypeBO;
import com.naiterui.ehp.bs.b2c.inventory.exception.StockServiceException;
import com.naiterui.ehp.bs.b2c.order.exception.OrderBusinessException;
import com.naiterui.ehp.bs.b2c.order.vo.OrderInfoVO;
import com.naiterui.ehp.bs.b2c.order.vo.OrderLiteVO;
import com.naiterui.ehp.bs.b2c.order.vo.OrderStatisticalVO;
import com.naiterui.ehp.bs.b2c.order.vo.PlaceOrderParamVO;
import com.naiterui.ehp.bs.b2c.order.vo.PlaceOrderVO;
import com.naiterui.ehp.bs.b2c.order.vo.ShippingInfoVO;
import com.naiterui.ehp.bs.b2c.order.vo.UnifiedOrderResultVO;

public interface IOrderService {

    /**
     * 获取支付方式
     */
    List<PayTypeBO> getPayTypes();

    /**
     * 系统自动取消订单
     */
    void cancel(Long orderId) throws BusinessException;

    /**
     * 取消订单 未支付的订单都可以取消
     */
    void cancel(Long userId, Long orderId) throws BusinessException;

    /**
     * CMS取消订单 未发货前都可以取消订单
     */
    void cancel(Set<Long> orderIds, String operator) throws BusinessException;

    /**
     * 调用微信获取支付信息
     */
    UnifiedOrderResultVO payOrder(Long orderId, String ip) throws BusinessException;

    /**
     * 订单列表
     */
    PageVO<OrderLiteVO> list(PageParamVO pageParamVO, Integer status, Long userId);

    /**
     * 订单详情
     */
    OrderInfoVO getOrderDetail(Long orderId, Long userId) throws BusinessException;

    /**
     * 创建订单
     */
    PlaceOrderVO createOrder(PlaceOrderParamVO placeOrderParamVO) throws BusinessException;

    /**
     * 微信回调
     */
    void notifyOrderPayStatus(NotifyBusinessPayBO notifyBusinessPay) throws OrderBusinessException;

    /**
     * 获取物流信息
     */
    ShippingInfoVO getShippingInfo(Long orderId, Long userId);

    /**
     * 订单审核
     */
    void auditOrder(Set<Long> orderIds, String operator) throws OrderBusinessException;

    /**
     * 订单反审核
     */
    void returnAuditOrder(Set<Long> orderIds, String operator);

    /**
     * 药店确认订单
     */
    void warehouseConfirmOrder(Long warehouseId, Set<Long> orderIds, String operator, Integer status) throws OrderBusinessException;

    /**
     * 药店发货
     */
    void deliveryOrder(Long warehouseId, Set<OrderDeliveryBO> deliveryInfo, String operator) throws OrderBusinessException, StockServiceException;

    /**
     * 修改订单
     */
    void updateOrder(UpdateOrderBO updateOrder, String operator) throws BusinessException, StockServiceException;

    /**
     * 查询推荐所属订单是否未支付
     *
     * @param recomId
     *
     * @return
     */
    boolean hasWaitPayByRecomId(Long recomId);

    /**
     * 获取用户订单汇总数量信息
     * @param patientId
     * @return
     */
    OrderStatisticalVO getOrderStatisticalInfo(Long patientId);

    Map<Long, Long> getOrderByRecomIds(Set<Long> recomIds);

    CustomOrderInfoBO getOrderDetailByOrderSn(String orderSn) throws BusinessException;
}
